using System.Collections.Generic;
using UnityEngine;

public class UpSceneDoorManager : MonoBehaviour
{
    [SerializeField] private List<UpSceneDoorTrigger> _upSceneDoorTriggers;
    [SerializeField] private DialogueDataBase _selectFailDialogueData;
    [SerializeField] private DialogueDataBase _selectSuccessDialogueData;
    [SerializeField] private WeaponScrollDataListSO _weaponScrollDataListSO;

    [SerializeField] private Collider2D _downColl;
    private void Start()
    {
        ResetAllTrigger();
    }
    public void ResetAllTrigger()
    {
        for (int i = 0; i < _upSceneDoorTriggers.Count; i++)
            _upSceneDoorTriggers[i].ResetTrigger(_selectFailDialogueData);
        int triggerCount = _upSceneDoorTriggers.Count;

        int randomIndex = Random.Range(0, triggerCount);

        _upSceneDoorTriggers[randomIndex].SetupTriggerCanGetScroll(_selectSuccessDialogueData, _weaponScrollDataListSO);
    }

    public void SetGameSuccess()
    {
        for (int i = 0; i < _upSceneDoorTriggers.Count; i++)
            _upSceneDoorTriggers[i].DiabaleInteract();

        _downColl.isTrigger = true;
    }
}
